package cn.hiapi.admin.query;

import cn.hiapi.basic.jpa.pageable.QueryWrapper;
import cn.hiapi.basic.jpa.query.BasicQuery;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;

/**
 * @author AdinZ
 * @date 2022/12/16 22:03
 */
@Setter
@Getter
public class ActivityCategoryQuery extends BasicQuery {
    private Long cid;
    private String name;
    @ApiModelProperty("状态")
    private Integer status;

    @Override
    public QueryWrapper getQueryWrapper() {
        QueryWrapper wrapper = super.getBasicQueryWrapper();
        if (StringUtils.isNotEmpty(name)) {
            wrapper.like("name", StringUtils.join("%", name, "%"));
        }
        wrapper.eq("cid", cid);
        wrapper.eq("status", status);
        return wrapper;
    }
}
